<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/29 0029
  Time: 上午 9:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>预订租车列表</title>
    <link  href="/static/plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="/static/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet" >
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <style>
        .mainDiv{
            padding: 30px;
        }

        .search{
            padding: 20px;
        }
        .layui-form-label{
            width: 100px;
        }
        #phone{
            margin-left: 50px;
        }
    </style>
</head>
<body>

<div class="mainDiv">


    <div class="search" style="margin-top: 10px">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-md1">
                <div class="layui-form-item">
                    <label class="layui-form-label">订单号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="orderid"  id="orderid"  autocomplete="off" placeholder="请输入订单号">
                    </div>
                </div>
            </div>
            <div class="layui-col-md1 layui-col-md-offset2">
                <div class="layui-form-item">
                    <label class="layui-form-label" id="phone">客户手机：</label>
                    <div class="layui-input-block">
                        <input type="text" name="mobile"  id="mobile"  autocomplete="off" placeholder="请客户手机号">
                    </div>
                </div>
            </div>

            <div class="layui-col-md1 layui-col-md-offset2">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <%-- <button class="layui-btn" lay-submit lay-filter="formSubmit">查询</button>--%>
                        <button type="button" class="layui-btn" id="search">查询</button>

                    </div>
                </div>

            </div>
        </div>
    </div>



    <table id="tb_car_select" ></table>

</div>

<%--1、引入jQuery组件--%>
<script src="/static/plugins/jquery.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<%--2、引入bootstrap组件--%>
<script src="/static/plugins/bootstrap/js/bootstrap.js"></script>
<%--3、bootstrap table组件以及中文包的引用--%>
<script src="/static/plugins/bootstrap-table/bootstrap-table.js"></script>
<script src="/static/plugins/bootstrap-table/bootstrap-table-zh-CN.js"></script>
<script>


    layui.use(["element","layer"],function () {
        var element = layui.element;
        var layer = layui.layer;


        window.operateEvents = {
            'click .payment': function (e, value, row, index) {

                location.href = "/yurent/payOrder?id="+row.id+"&carid="+row.carid
            }
        }

        $("#search").on('click',function (data) {

            var orderid = $("#orderid").val()
            var mobile = $("#mobile").val()
            debugger
            $("#tb_car_select").bootstrapTable("refresh",{
                query:{
                    orderid:orderid,
                    mobile:mobile,
                }
            });
        })

        $("#tb_car_select").bootstrapTable({
            url: '/yurent/findYuDingCarList',         //请求后台的URL（*）
            method: 'get',                      //请求方式（*）
            toolbar: '#toolbar',                //工具按钮用哪个容器
            striped: true,                      //是否显示行间隔色
//            cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
            pagination: true,                   //是否显示分页（*）
            sortable: false,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            queryParams: function (data) {
                var params = {
                    offset: data.offset,
                    limit: data.limit
                };
                return params
            },                  // 传递自定义参数,还要加上offset，limit（*）
            sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 15, 20, 50],        //可供选择的每页的行数（*）
            showRefresh: true,                  //是否显示刷新按钮
            clickToSelect: true,                //是否启用点击选中行
            height: 700,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "id",                     //每一行的唯一标识，一般为主键列
            columns: [
                {
                    checkbox: true
                }, {
                    field: 'orderid',
                    title: '订单号',
                    align: "center",

                }, {
                    field: 'mobile',
                    title: '客户手机',
                    align: "center"
                }, {
                    field: 'name',
                    title: '客户姓名',
                    align: "center",
                }, {
                    field: 'carbrand',
                    title: '车辆型号',
                    align:'center',
                }, {
                    field: 'readybttime',
                    title: '租用开始时间',
                    align: "center",
                    formatter:function (value, row, index) {
                        if(isNaN(value)){
                            return "--";
                        } else {
                            var time = new Date(value);
                            return time.toLocaleDateString().replace("/","-").replace("/","-");
                        }
                    }
                }
                , {
                    field: 'readettime',
                    title: '租用截止时间',
                    align: "center",
                    formatter:function (value, row, index) {
                        if(isNaN(value)){
                            return "--";
                        } else {
                            var time = new Date(value);
                            return time.toLocaleDateString().replace("/","-").replace("/","-");
                        }
                    }
                }, {
                    field: 'addtime',
                    title: '订单时间',
                    align: "center",
                    formatter:function (value, row, index) {
                        if(isNaN(value)){
                            return "--";
                        } else {
                            var time = new Date(value);
                            return time.toLocaleDateString().replace("/","-").replace("/","-");
                        }
                    }
                },{
                    field: 'operate',
                    title: '操作',
                    align:'center',
                    events: operateEvents,
                    formatter: operateFormatter
                }
            ]
        });
        function operateFormatter(value, row, index) {
            return [
                '<input type="submit" value="缴费" class="payment"   data-toggle="modal" style="display:inline;color: #01AAED;width: 50px">',
                '<input type="submit" value="取消" class=""   data-toggle="modal" style="display:inline;color: #01AAED;width: 50px">',
            ].join('');
        }
    })



</script>


</body>
</html>

